﻿using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;

// Token: 0x020003A3 RID: 931
public class DropDownUI : MonoBehaviour
{
	// Token: 0x1700023E RID: 574
	// (get) Token: 0x06001727 RID: 5927 RVA: 0x0009B318 File Offset: 0x00099518
	// (set) Token: 0x06001728 RID: 5928 RVA: 0x0009B328 File Offset: 0x00099528
	public int Value
	{
		get
		{
			return this.dropdown.value;
		}
		set
		{
			this.SetValue(value);
		}
	}

	// Token: 0x06001729 RID: 5929 RVA: 0x0009B334 File Offset: 0x00099534
	private void Awake()
	{
		this.dropdown.onValueChanged.AddListener(new UnityAction<int>(this.OnDropdownValueChange));
		EventTrigger eventTrigger = this.GetEventTrigger();
		EventTrigger.Entry entry = new EventTrigger.Entry();
		entry.eventID = EventTriggerType.PointerClick;
		entry.callback.AddListener(delegate(BaseEventData data)
		{
			SystemSE.Play(SystemSE.SE.CHOICE);
		});
		eventTrigger.triggers.Add(entry);
	}

	// Token: 0x0600172A RID: 5930 RVA: 0x0009B3A8 File Offset: 0x000995A8
	public void SetValue(int val)
	{
		if (!this.invoke)
		{
			return;
		}
		this.invoke = false;
		this.dropdown.value = val;
		this.invoke = true;
	}

	// Token: 0x0600172B RID: 5931 RVA: 0x0009B3D0 File Offset: 0x000995D0
	public void SetTitle(string str)
	{
		this.title.text = str;
	}

	// Token: 0x0600172C RID: 5932 RVA: 0x0009B3E0 File Offset: 0x000995E0
	public void SetList(List<Dropdown.OptionData> options)
	{
		this.dropdown.options = options;
	}

	// Token: 0x0600172D RID: 5933 RVA: 0x0009B3F0 File Offset: 0x000995F0
	public void AddOnValueChange(UnityAction<int> onValueChange)
	{
		this.act.AddListener(onValueChange);
	}

	// Token: 0x0600172E RID: 5934 RVA: 0x0009B400 File Offset: 0x00099600
	private void OnDropdownValueChange(int no)
	{
		if (!this.invoke)
		{
			return;
		}
		if (this.act != null)
		{
			this.act.Invoke(no);
		}
		SystemSE.Play(SystemSE.SE.CHOICE);
	}

	// Token: 0x0600172F RID: 5935 RVA: 0x0009B42C File Offset: 0x0009962C
	public EventTrigger GetEventTrigger()
	{
		EventTrigger component = base.GetComponent<EventTrigger>();
		if (component)
		{
			return component;
		}
		return base.gameObject.AddComponent<EventTrigger>();
	}

	// Token: 0x04001AE4 RID: 6884
	[SerializeField]
	private Text title;

	// Token: 0x04001AE5 RID: 6885
	public Dropdown dropdown;

	// Token: 0x04001AE6 RID: 6886
	private bool invoke = true;

	// Token: 0x04001AE7 RID: 6887
	[SerializeField]
	private DropDownUI.OnChangeEvent act;

	// Token: 0x020003A4 RID: 932
	[Serializable]
	private class OnChangeEvent : UnityEvent<int>
	{
	}
}
